package com.sy.core.service;

import com.sy.core.mapper.SyBannerMapper;
import com.sy.core.model.SyBanner;
import com.sy.core.web.BaseCtl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.Banner;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service("bannerService")
public class BannerService extends BaseCtl {
    @Autowired
    private SyBannerMapper syBannerMapper;

    public List<Map<String,Object>> queryList(SyBanner syBanner) {
        return syBannerMapper.queryList(syBanner);
    }

    public String insertSelective(SyBanner syBanner) {
        String pk = syBanner.getPk();
        if(pk==null||pk.equalsIgnoreCase("")){
            syBanner.setPk(getPrimaryKey());
            //syBanner.setNo3();todo
            //syBanner.setNo4();//todo
            syBannerMapper.insertSelective(syBanner);
        }else{
            syBannerMapper.updateByPrimaryKeySelective(syBanner);
        }
        return pk;
    }

    public Map<String, Object> queryOne(String pk) {
        return syBannerMapper.selectByPrimaryKeyForMap(pk);
    }

    public int batchDel(String pks) {
        return syBannerMapper.batchDel(pks);
    }
}
